package tech.senri.iot.socket.model

import io.netty.buffer.Unpooled
import io.swagger.annotations.ApiModelProperty
import tech.senri.iot.socket.service.util.getArray

class UpdateDiscountRequest : RequestMessage()
{
    override fun contentData(): ByteArray
    {
        return Unpooled.buffer().writeByte(enableDiscount)
            .writeShort(aisleCount)
            .writeBytes(discountAmount?.map { it.toByte() }?.toByteArray())
            .getArray()
    }

    @ApiModelProperty("货道数量")
    var aisleCount: Int = 0

    @ApiModelProperty("商品打折启用/停用，1：表示开启打折，0：表示不打折")
    var enableDiscount: Int = 0

    @ApiModelProperty("打折后商品价格，对应每个货道")
    var discountAmount: IntArray? = null
}
